﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JoystickCtrl : UIBase
{

    private ETCJoystick joystick;

    void Start()
    {
        joystick = GetComponent<ETCJoystick>();

        joystick.onMove.AddListener(onMove);
    }


    public override void OnDestroy()
    {
        base.OnDestroy();
        joystick.onMove.RemoveListener(onMove);
    }

    void onMove(Vector2 direction)
    {
        //角色移动
        //播放动画
        Dispatch(AreaCode.CHARACTER, CharacterEvent.MOVE, direction);
        //播放声音
        Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_AUDIO, "角色行走的声音");
        //...

        //SendMessage();
    }


}
